package fr.fbhelp.config
{
	import flash.system.Capabilities;
	
	import mx.resources.IResourceManager;
	import mx.resources.ResourceManager;

	public class UserLocale
	{
		public function UserLocale()
		{
		}
		
		/**
		 * Get the pat to user's locale. 
		 * @return Locale string in form "en_US", "ru_RU" etc.;  
		 */		
		public static function get currentLocale():String
		{
			var language:String = Capabilities.languages[0];
			var localePath:String = language.replace("-", "_");
			return localePath;
		}
		
		/**
		 * Not used in application. Only for test 
		 * @return 
		 * @private
		 */
		public static function getLocaleFromResourceManager():String
		{
			var localePath:String;
			var rm:IResourceManager = ResourceManager.getInstance();
			var larray:Array = rm.getLocales();
			for each (var l:* in larray)
			{
				localePath = l.toString();
			}
			return localePath;
		}
	}
}